//
//  PersonFactory.m
//  FactoryDemo
//
//  Created by hs on 2017/7/13.
//  Copyright © 2017年 jiachen. All rights reserved.
//

#import "PersonFactory.h"
#import "Teacher.h"
#import "Student.h"
#import "Person.h"

NSString *TeacherClassName = @"Teacher";
NSString *StudentClassName = @"Student";

@implementation PersonFactory

//+ (instancetype)initWithDictionary:(NSDictionary *)dictionary{
//    
//    
//    
//}

- (void)createObject:(NSString *)className compelete:(void (^)(Person *))callBlock{
    
    if ([className isEqualToString:NSStringFromClass([Teacher class])]) {
        
        Teacher *teacher = [[Teacher alloc]init];
        callBlock(teacher);
        [teacher teachStudent];
    }
    
    if ([className isEqualToString:NSStringFromClass([Student class])]) {
        
        Student *student = [[Student alloc]init];
        callBlock(student);
        [student learnKnowledge];
    }
    
}

@end
